const backendController = {
  index: function () {
    const { createApp, ref, onMounted } = Vue;
    const { dayjs } = ElementPlus;
    const app = createApp({
      setup() {
        const isCollapse = ref(false);

        const activeIndex = ref("1");
        const activeIndex2 = ref("1");
        const mainUrl = ref("");

        const message = ref("123");

        onMounted(() => {
          //console.log(dayjs("2023-05-15").format("YYYY-MM-DD HH:mm:ss"));

          mainUrl.value = window.location.hash.substring(1);
          if (mainUrl.value === "") {
            mainUrl.value = "/admin/index";
            location.href = "#/admin/index";
          }
        });

        const handleSelect = (index) => {
          console.log(index);
          switch (index) {
            case "1":
              mainUrl.value = "/admin/index";
              location.href = "#/admin/index";
              break;
            case "6":
              mainUrl.value = "/admin/crud";
              location.href = "#/admin/crud";
              break;
          }
        };
        return {
          mainUrl,
          handleSelect,
          message,
          activeIndex,
          activeIndex2,
          isCollapse,
        };
      },
    });

    // Use Element Plus in the application
    app.use(ElementPlus);

    // Configure delimiters
    app.config.compilerOptions.delimiters = ["${", "}"];

    // Mount the application
    app.mount("#app");
  },
};
backendController[appConfig.action]();
